public class RecursiveSum {
    public static void main(String[] args) {
        System.out.println(sum(222));
    }
    public static int sum(int n){
        int b=0;
        if(n<10){
            return n;
        }return sum(n/10)%10+b;
    }
}
